/**
* @application Automatical Judging System
* @author deltamaster
* @copyright Softrank Research Center
* @version 2.0.0.0
*/ 
<!--
//function $(id){return document.getElementById(id);}
function createObj()
{
	var o=null;
	if(typeof(XMLHttpRequest)!="undefined") return new XMLHttpRequest();  
	if(window.ActiveXObject){
		var MSXML=["MSXML2.XMLHttp.6.0","MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHTTP"];
		for(var i=0; i < MSXML.length; i++){
			try{
				o= new ActiveXObject(MSXML[i]);return o;
			}
			catch(e){}
		}
	}
	return null;
}

function SendData(v, name, spanname){
	var o=createObj();
	if (name == "confirmpassword") {
		if ($('#inputpassword')[0].value == $('#confirmpassword')[0].value) $('#'+spanname)[0].innerHTML="{lang valid}";
		else $('#'+spanname)[0].innerHTML="{lang invalid}: {lang not_match}";
		return;
	}
	var url="ajax.php?"+name+"="+v;
	o.open("get",url,true);
	o.onreadystatechange=function(){
		if(o.readyState==4){
			if(o.status==200)$('#'+spanname)[0].innerHTML=o.responseText;
			else alert("{lang error_occur}");
		}
	}
	o.send(null);
}

function EnableObject(v)
{
	if($('#'+v)[0].getAttribute('disabled'))
	{
		$('#'+v)[0].removeAttribute('disabled');
	}
}

function show(element, type, n)
{
	var allChild = $('#'+element)[0].getElementsByTagName(type);
	for (i = 0 ; i < allChild.length; i++)
	{
		if (i == n) allChild[i].style.display = "block";
		else allChild[i].style.display = "none";
	}
}
<!--{if ($action == 'edit' || $action == 'add')}-->
function makenewoptions()
{
	answers = $('#choice')[0].value.split("\n");
	k = 1;
	for (i = $('#answer')[0].options.length - 1; i >= 0; i--) $('#answer')[0].options.remove(i);
	for (i = 0; i < answers.length; i++){
		var item = new Option(answers[i], k);
		$('#answer')[0].options.add(item);
		k *= 2;
	}
}
function mmakenewoptions()
{
	answers = $('#mchoice')[0].value.split("\n");
	k = 1;
	for (i = $('#manswer')[0].options.length - 1; i >= 0; i--) $('#manswer')[0].options.remove(i);
	for (i = 0; i < answers.length; i++){
		var item = new Option(answers[i], k);
		$('#manswer')[0].options.add(item);
		k *= 2;
	}
}
<!--{/if}-->
-->